##### ################################################### ######
#####                                                     ######
#####   Input: clean experiment data                      ######
#####   Output: subgroup analysis                         ######
#####                                                     ######
##### ################################################### ######

setwd("/Users/lotte/Dropbox/PhD/style_experiment/replication")
rm(list=ls())

# Load libraries

library(margins) # CRAN v0.3.26
library(inauguration) # [github::ciannabp/inauguration] v0.0.0.9000
library(data.table) # CRAN v1.14.2
library(plyr) # CRAN v1.8.6
library(dplyr) # CRAN v1.0.9
library(tidyverse) # CRAN v1.3.1
library(ggplot2) # CRAN v3.3.6
library(broom) # CRAN v0.7.11
library(patchwork) # CRAN v1.1.1
library(estimatr) # CRAN 0.30.6

# Load clean experiment data

load("data/style_data.Rdata")
load("data/emotion_data.Rdata")
load("data/aggression_data.Rdata")
load("data/evidence_data.Rdata")

# Conditional by voter gender ----------------------------------------------------------------------------------

emotion_likeability_woman <- lm(perceived_likeability ~ objective_style_emotion -1,
                                data = emotion,
                                subset = emotion$respondent_gender=="Woman")
emotion_likeability_man <- lm(perceived_likeability ~ objective_style_emotion -1,
                              data = emotion,
                              subset = emotion$respondent_gender=="Man")
aggression_likeability_woman <- lm(perceived_likeability ~ objective_style_aggression -1 ,
                                   data = aggression,
                                   subset = aggression$respondent_gender=="Woman")
aggression_likeability_man <- lm(perceived_likeability ~ objective_style_aggression -1,
                                 data = aggression,
                                 subset = aggression$respondent_gender=="Man")
evidence_likeability_woman <- lm(perceived_likeability ~ prevalence_evidence -1,
                                 data = evidence,
                                 subset = evidence$respondent_gender=="Woman")
evidence_likeability_man <- lm(perceived_likeability ~ prevalence_evidence -1,
                               data = evidence,
                               subset = evidence$respondent_gender=="Man")

emotion_perception_woman <- lm(perceived_emotion ~ objective_style_emotion -1,
                               data = emotion,
                               subset = emotion$respondent_gender=="Woman")

emotion_perception_man <- lm(perceived_emotion ~ objective_style_emotion -1,
                             data = emotion,
                             subset = emotion$respondent_gender=="Man")

aggression_perception_woman <- lm(perceived_aggression ~ objective_style_aggression -1,
                                  data = aggression,
                                  subset = aggression$respondent_gender=="Woman")

aggression_perception_man <- lm(perceived_aggression ~ objective_style_aggression -1,
                                data = aggression,
                                subset = aggression$respondent_gender=="Man")

evidence_perception_woman <- lm(perceived_evidence ~ prevalence_evidence -1,
                                data = evidence,
                                subset = evidence$respondent_gender=="Woman")

evidence_perception_man <- lm(perceived_evidence ~ prevalence_evidence -1,
                              data = evidence,
                              subset = evidence$respondent_gender=="Man")

emotion_competence_woman <- lm(perceived_competence ~ objective_style_emotion -1,
                               data = emotion,
                               subset = emotion$respondent_gender=="Woman")

emotion_competence_man <- lm(perceived_competence ~ objective_style_emotion -1,
                             data = emotion,
                             subset = emotion$respondent_gender=="Man")

aggression_competence_woman <- lm(perceived_competence ~ objective_style_aggression -1,
                                  data = aggression,
                                  subset = aggression$respondent_gender=="Woman")

aggression_competence_man <- lm(perceived_competence ~ objective_style_aggression -1,
                                data = aggression,
                                subset = aggression$respondent_gender=="Man")

evidence_competence_woman <- lm(perceived_competence ~ prevalence_evidence -1,
                                data = evidence,
                                subset = evidence$respondent_gender=="Woman")

evidence_competence_man <- lm(perceived_competence ~ prevalence_evidence -1,
                              data = evidence,
                              subset = evidence$respondent_gender=="Man")

emotion_voter_conditional <- bind_rows(
  tidy(emotion_likeability_woman, conf.int = T)%>%mutate(model="Emotion", gender="Woman", outcome="Likeability"),
  tidy(emotion_likeability_man, conf.int = T)%>%mutate(model="Emotion", gender="Man", outcome="Likeability"),
  tidy(emotion_competence_woman, conf.int = T)%>%mutate(model="Emotion", gender="Woman", outcome="Competence"),
  tidy(emotion_competence_man, conf.int = T)%>%mutate(model="Emotion", gender="Man", outcome="Competence"),
  tidy(emotion_perception_woman, conf.int = T)%>%mutate(model="Emotion", gender="Woman", outcome="Style Perception"),
  tidy(emotion_perception_man, conf.int = T)%>%mutate(model="Emotion", gender="Man", outcome="Style Perception"))%>%
  mutate(treatment=c("Non-emotional", "Emotional", "Non-emotional", "Emotional", "Non-emotional", "Emotional",
                     "Non-emotional", "Emotional", "Non-emotional", "Emotional", "Non-emotional", "Emotional"))

aggression_voter_conditional <- bind_rows(
  tidy(aggression_likeability_woman, conf.int = T)%>%mutate(model="Aggression", gender="Woman", outcome="Likeability"),
  tidy(aggression_likeability_man, conf.int = T)%>%mutate(model="Aggression", gender="Man", outcome="Likeability"),
  tidy(aggression_competence_woman, conf.int = T)%>%mutate(model="Aggression", gender="Woman", outcome="Competence"),
  tidy(aggression_competence_man, conf.int = T)%>%mutate(model="Aggression", gender="Man", outcome="Competence"),
  tidy(aggression_perception_woman, conf.int = T)%>%mutate(model="Aggression", gender="Woman", outcome="Style Perception"),
  tidy(aggression_perception_man, conf.int = T)%>%mutate(model="Aggression", gender="Man", outcome="Style Perception"))%>%
  mutate(treatment=c( "Non-aggressive", "Aggressive", "Non-aggressive", "Aggressive", "Non-aggressive", "Aggressive",
                      "Non-aggressive", "Aggressive", "Non-aggressive", "Aggressive", "Non-aggressive", "Aggressive"))

evidence_voter_conditional <- bind_rows(
  tidy(evidence_likeability_woman, conf.int = T)%>%mutate(model="Evidence", gender="Woman", outcome="Likeability"),
  tidy(evidence_likeability_man, conf.int = T)%>%mutate(model="Evidence", gender="Man", outcome="Likeability"),
  tidy(evidence_competence_woman, conf.int = T)%>%mutate(model="Evidence", gender="Woman", outcome="Competence"),
  tidy(evidence_competence_man, conf.int = T)%>%mutate(model="Evidence", gender="Man", outcome="Competence"),
  tidy(evidence_perception_woman, conf.int = T)%>%mutate(model="Evidence", gender="Woman", outcome="Style Perception"),
  tidy(evidence_perception_man, conf.int = T)%>%mutate(model="Evidence", gender="Man", outcome="Style Perception"))%>%
  mutate(treatment=c("Statistical", "Anecdotal", "Statistical", "Anecdotal", "Statistical", "Anecdotal",
         "Statistical", "Anecdotal",  "Statistical", "Anecdotal", "Statistical", "Anecdotal"))


emotion_voter_conditional_plot <- ggplot(emotion_voter_conditional, aes(y=estimate,x=treatment, group = gender, color = gender)) +
  geom_point(position = position_dodge(width=0.2)) + ylab("") + xlab("") +
  geom_linerange(position = position_dodge(width=0.2), aes(ymin = conf.low, ymax = conf.high, linetype = gender)) +
  facet_grid(model~outcome,scales="free") +
  theme_bw() + ylim(2.75,4) +
  scale_color_manual(values = c("lightseagreen", "grey40")) +
  scale_shape_manual(values=c(19,1)) +
  labs(color="Voter gender", linetype="Voter gender", shape="Voter gender") +
  theme(axis.text=element_text(size=11),
        strip.text.y = element_text(size=11),
        strip.text.x = element_text(size=11),
        legend.title = element_text(size=11))

aggression_voter_conditional_plot <- ggplot(aggression_voter_conditional, aes(y=estimate,x=treatment, group = gender, color = gender)) +
  geom_point(position = position_dodge(width=0.2)) + ylab("") + xlab("") +
  geom_linerange(position = position_dodge(width=0.2), aes(ymin = conf.low, ymax = conf.high, linetype = gender)) +
  facet_grid(model~outcome,scales="free") +
  theme_bw() + ylim(2.75,4) +
  scale_color_manual(values = c("lightseagreen", "grey40")) +
  scale_shape_manual(values=c(19,1)) +
  labs(color="Voter gender", linetype="Voter gender", shape="Voter gender") +
  theme(axis.text=element_text(size=11),
        strip.text.y = element_text(size=11),
        strip.text.x = element_text(size=11),
        legend.title = element_text(size=11))

evidence_voter_conditional_plot <- ggplot(evidence_voter_conditional, aes(y=estimate,x=treatment, group = gender, color = gender)) +
  geom_point(position = position_dodge(width=0.2)) + ylab("") + xlab("") +
  geom_linerange(position = position_dodge(width=0.2), aes(ymin = conf.low, ymax = conf.high, linetype = gender)) +
  facet_grid(model~outcome,scales="free") +
  theme_bw() + ylim(2.75,4) +
  scale_color_manual(values = c("lightseagreen", "grey40")) +
  scale_shape_manual(values=c(19,1)) +
  labs(color="Voter gender", linetype="Voter gender", shape="Voter gender") +
  theme(axis.text=element_text(size=11),
        strip.text.y = element_text(size=11),
        strip.text.x = element_text(size=11),
        legend.title = element_text(size=11))

voter_gender_conditional <- emotion_voter_conditional_plot / aggression_voter_conditional_plot / evidence_voter_conditional_plot
ggsave("analysis/plots/figure_S5_voter_gender_conditional.pdf", voter_gender_conditional, width = 10, height = 6.5)

# Conditional voter and MP gender ----------------------------------------------------------------------------------

emotion_men <- emotion[emotion$respondent_gender=="Man",]
emotion_women <- emotion[emotion$respondent_gender=="Woman",]
aggression_men <- aggression[aggression$respondent_gender=="Man",]
aggression_women <- aggression[aggression$respondent_gender=="Woman",]
evidence_men <- evidence[evidence$respondent_gender=="Man",]
evidence_women <- evidence[evidence$respondent_gender=="Woman",]

emotion_likeability_women_woman <- lm(perceived_likeability ~ objective_style_emotion -1,
                          data = emotion_women,
                          subset = emotion$mp_gender=="Woman")

emotion_likeability_women_man <- lm(perceived_likeability ~ objective_style_emotion -1,
                        data = emotion_men,
                        subset = emotion_men$mp_gender=="Woman")

emotion_likeability_man_woman <- lm(perceived_likeability ~ objective_style_emotion -1,
                        data = emotion_women,
                        subset = emotion_women$mp_gender=="Man")

emotion_likeability_man_man <- lm(perceived_likeability ~ objective_style_emotion -1,
                      data = emotion_men,
                      subset = emotion_men$mp_gender=="Man")

aggression_likeability_women_woman <- lm(perceived_likeability ~ objective_style_aggression -1,
                             data = aggression_women,
                             subset = aggression$mp_gender=="Woman")

aggression_likeability_women_man <- lm(perceived_likeability ~ objective_style_aggression -1,
                           data = aggression_men,
                           subset = aggression_men$mp_gender=="Woman")

aggression_likeability_man_woman <- lm(perceived_likeability ~ objective_style_aggression -1,
                           data = aggression_women,
                           subset = aggression_women$mp_gender=="Man")

aggression_likeability_man_man <- lm(perceived_likeability ~ objective_style_aggression -1,
                         data = aggression_men,
                         subset = aggression_men$mp_gender=="Man")

evidence_likeability_woman_woman <- lm(perceived_likeability ~ style_prevalence -1,
                           data = evidence_women,
                           subset = evidence$mp_gender=="Woman")

evidence_likeability_woman_man <- lm(perceived_likeability ~ style_prevalence -1,
                         data = evidence_men,
                         subset = evidence_men$mp_gender=="Woman")

evidence_likeability_man_woman <- lm(perceived_likeability ~ style_prevalence -1,
                         data = evidence_women,
                         subset = evidence_women$mp_gender=="Man")

evidence_likeability_man_man <- lm(perceived_likeability ~ style_prevalence -1,
                       data = evidence_men,
                       subset = evidence_men$mp_gender=="Man")

emotion_competence_women_woman <- lm(perceived_competence ~ objective_style_emotion -1,
                                      data = emotion_women,
                                      subset = emotion$mp_gender=="Woman")

emotion_competence_women_man <- lm(perceived_competence ~ objective_style_emotion -1,
                                    data = emotion_men,
                                    subset = emotion_men$mp_gender=="Woman")

emotion_competence_man_woman <- lm(perceived_competence ~ objective_style_emotion -1,
                                    data = emotion_women,
                                    subset = emotion_women$mp_gender=="Man")

emotion_competence_man_man <- lm(perceived_competence ~ objective_style_emotion -1,
                                  data = emotion_men,
                                  subset = emotion_men$mp_gender=="Man")

aggression_competence_women_woman <- lm(perceived_competence ~ objective_style_aggression -1,
                                         data = aggression_women,
                                         subset = aggression$mp_gender=="Woman")

aggression_competence_women_man <- lm(perceived_competence ~ objective_style_aggression -1,
                                       data = aggression_men,
                                       subset = aggression_men$mp_gender=="Woman")

aggression_competence_man_woman <- lm(perceived_competence ~ objective_style_aggression -1,
                                       data = aggression_women,
                                       subset = aggression_women$mp_gender=="Man")

aggression_competence_man_man <- lm(perceived_competence ~ objective_style_aggression -1,
                                     data = aggression_men,
                                     subset = aggression_men$mp_gender=="Man")

evidence_competence_woman_woman <- lm(perceived_competence ~ style_prevalence -1,
                                       data = evidence_women,
                                       subset = evidence$mp_gender=="Woman")

evidence_competence_woman_man <- lm(perceived_competence ~ style_prevalence -1,
                                     data = evidence_men,
                                     subset = evidence_men$mp_gender=="Woman")

evidence_competence_man_woman <- lm(perceived_competence ~ style_prevalence -1,
                                     data = evidence_women,
                                     subset = evidence_women$mp_gender=="Man")

evidence_competence_man_man <- lm(perceived_competence ~ style_prevalence -1,
                                   data = evidence_men,
                                   subset = evidence_men$mp_gender=="Man")

emotion_women_woman <- lm(perceived_emotion ~ objective_style_emotion -1,
                                  data = emotion_women,
                                  subset = emotion_women$mp_gender=="Woman")

emotion_women_man <- lm(perceived_emotion ~ objective_style_emotion -1,
                   data = emotion_men,
                   subset = emotion_men$mp_gender=="Woman")

emotion_man_woman <- lm(perceived_emotion ~ objective_style_emotion -1,
                         data = emotion_women,
                         subset = emotion_women$mp_gender=="Man")

emotion_man_man <- lm(perceived_emotion ~ objective_style_emotion -1,
                       data = emotion_men,
                       subset = emotion_men$mp_gender=="Man")


aggression_women_woman <- lm(perceived_aggression ~ objective_style_aggression -1,
                          data = aggression_women,
                          subset = aggression$mp_gender=="Woman")

aggression_women_man <- lm(perceived_aggression ~ objective_style_aggression -1,
                        data = aggression_men,
                        subset = aggression_men$mp_gender=="Woman")

aggression_man_woman <- lm(perceived_aggression ~ objective_style_aggression -1,
                        data = aggression_women,
                        subset = aggression_women$mp_gender=="Man")

aggression_man_man <- lm(perceived_aggression ~ objective_style_aggression -1,
                      data = aggression_men,
                      subset = aggression_men$mp_gender=="Man")

evidence_woman_woman <- lm(perceived_evidence ~ style_prevalence -1,
                             data = evidence_women,
                             subset = evidence$mp_gender=="Woman")

evidence_woman_man <- lm(perceived_evidence ~ style_prevalence -1,
                           data = evidence_men,
                           subset = evidence_men$mp_gender=="Woman")

evidence_man_woman <- lm(perceived_evidence ~ style_prevalence -1,
                           data = evidence_women,
                           subset = evidence_women$mp_gender=="Man")

evidence_man_man <- lm(perceived_evidence ~ style_prevalence -1,
                         data = evidence_men,
                         subset = evidence_men$mp_gender=="Man")

emotion_mp_voter <- bind_rows(
  tidy(emotion_likeability_women_woman, conf.int = T)%>%mutate(model="Emotion", mp_gender="WomanMP", voter_gender="WomanVoter", outcome="Likeability"),
  tidy(emotion_likeability_women_man, conf.int = T)%>%mutate(model="Emotion", mp_gender="WomanMP", voter_gender="ManVoter", outcome="Likeability"),
  tidy(emotion_likeability_man_woman, conf.int = T)%>%mutate(model="Emotion", mp_gender="ManMP", voter_gender="WomanVoter", outcome="Likeability"),
  tidy(emotion_likeability_man_man, conf.int = T)%>%mutate(model="Emotion", mp_gender="ManMP", voter_gender="ManVoter", outcome="Likeability"),
  tidy(emotion_competence_women_woman, conf.int = T)%>%mutate(model="Emotion", mp_gender="WomanMP", voter_gender="WomanVoter", outcome="Competence"),
  tidy(emotion_competence_women_man, conf.int = T)%>%mutate(model="Emotion", mp_gender="WomanMP", voter_gender="ManVoter", outcome="Competence"),
  tidy(emotion_competence_man_woman, conf.int = T)%>%mutate(model="Emotion", mp_gender="ManMP", voter_gender="WomanVoter", outcome="Competence"),
  tidy(emotion_competence_man_man, conf.int = T)%>%mutate(model="Emotion", mp_gender="ManMP", voter_gender="ManVoter", outcome="Competence"),
  tidy(emotion_women_woman, conf.int = T)%>%mutate(model="Emotion", mp_gender="WomanMP", voter_gender="WomanVoter", outcome="Style Perception"),
  tidy(emotion_women_man, conf.int = T)%>%mutate(model="Emotion", mp_gender="WomanMP", voter_gender="ManVoter", outcome="Style Perception"),
  tidy(emotion_man_woman, conf.int = T)%>%mutate(model="Emotion", mp_gender="ManMP", voter_gender="WomanVoter", outcome="Style Perception"),
  tidy(emotion_man_man, conf.int = T)%>%mutate(model="Emotion", mp_gender="ManMP", voter_gender="ManVoter", outcome="Style Perception"))%>%
  mutate(treatment=c("Non-emotional", "Emotional", "Non-emotional", "Emotional","Non-emotional", "Emotional","Non-emotional", "Emotional",
                     "Non-emotional", "Emotional", "Non-emotional", "Emotional","Non-emotional", "Emotional","Non-emotional", "Emotional",
                     "Non-emotional", "Emotional", "Non-emotional", "Emotional","Non-emotional", "Emotional","Non-emotional", "Emotional"))

emotion_mp_voter_plot <- ggplot(emotion_mp_voter, aes(y=estimate,x=treatment, color = interaction(mp_gender, voter_gender),
                                                              shape = interaction(mp_gender, voter_gender),
                                                              group=interaction(mp_gender, voter_gender))) +
  geom_point(position = position_dodge(width=0.3)) + ylab("") + xlab("") +
  geom_linerange(position = position_dodge(width=0.3), aes(ymin = conf.low, ymax = conf.high)) +
  scale_color_manual(values = inauguration("inauguration_2021"), labels = c("Voter Man-MP Man", "Voter Man-MP Woman", "Voter Woman-MP Man", "Voter Woman-MP Woman")) +
  scale_shape_manual(values=c(15,16,17,18), labels = c("Voter Man-MP Man", "Voter Man-MP Woman", "Voter Woman-MP Man", "Voter Woman-MP Woman")) +
  labs(color="MP & voter gender \n combination", shape="MP & voter gender \n combination") +
  theme_bw() + ylim(2.65,4.2) +
  facet_grid(model~outcome, scales="free") +
  theme(axis.text=element_text(size=11),
        strip.text.y = element_text(size=11),
        strip.text.x = element_text(size=11),
        legend.title = element_text(size=11))

aggression_mp_voter <- bind_rows(
  tidy(aggression_likeability_women_woman, conf.int = T)%>%mutate(model="Aggression", mp_gender="WomanMP", voter_gender="WomanVoter", outcome="Likeability"),
  tidy(aggression_likeability_women_man, conf.int = T)%>%mutate(model="Aggression", mp_gender="WomanMP", voter_gender="ManVoter", outcome="Likeability"),
  tidy(aggression_likeability_man_woman, conf.int = T)%>%mutate(model="Aggression", mp_gender="ManMP", voter_gender="WomanVoter", outcome="Likeability"),
  tidy(aggression_likeability_man_man, conf.int = T)%>%mutate(model="Aggression", mp_gender="ManMP", voter_gender="ManVoter", outcome="Likeability"),
  tidy(aggression_competence_women_woman, conf.int = T)%>%mutate(model="Aggression", mp_gender="WomanMP", voter_gender="WomanVoter", outcome="Competence"),
  tidy(aggression_competence_women_man, conf.int = T)%>%mutate(model="Aggression", mp_gender="WomanMP", voter_gender="ManVoter", outcome="Competence"),
  tidy(aggression_competence_man_woman, conf.int = T)%>%mutate(model="Aggression", mp_gender="ManMP", voter_gender="WomanVoter", outcome="Competence"),
  tidy(aggression_competence_man_man, conf.int = T)%>%mutate(model="Aggression", mp_gender="ManMP", voter_gender="ManVoter", outcome="Competence"),
  tidy(aggression_women_woman, conf.int = T)%>%mutate(model="Aggression", mp_gender="WomanMP", voter_gender="WomanVoter", outcome="Style Perception"),
  tidy(aggression_women_man, conf.int = T)%>%mutate(model="Aggression", mp_gender="WomanMP", voter_gender="ManVoter", outcome="Style Perception"),
  tidy(aggression_man_woman, conf.int = T)%>%mutate(model="Aggression", mp_gender="ManMP", voter_gender="WomanVoter", outcome="Style Perception"),
  tidy(aggression_man_man, conf.int = T)%>%mutate(model="Aggression", mp_gender="ManMP", voter_gender="ManVoter", outcome="Style Perception"))%>%
  mutate(treatment=c("Non-aggressive", "Aggressive", "Non-aggressive", "Aggressive", "Non-aggressive", "Aggressive","Non-aggressive", "Aggressive",
                     "Non-aggressive", "Aggressive", "Non-aggressive", "Aggressive", "Non-aggressive", "Aggressive","Non-aggressive", "Aggressive",
                     "Non-aggressive", "Aggressive", "Non-aggressive", "Aggressive", "Non-aggressive", "Aggressive","Non-aggressive", "Aggressive"))

aggression_mp_voter_plot <- ggplot(aggression_mp_voter, aes(y=estimate,x=treatment, color = interaction(mp_gender, voter_gender),
                                                      shape = interaction(mp_gender, voter_gender),
                                                      group=interaction(mp_gender, voter_gender))) +
  geom_point(position = position_dodge(width=0.3)) + ylab("") + xlab("") +
  geom_linerange(position = position_dodge(width=0.3), aes(ymin = conf.low, ymax = conf.high)) +
  scale_color_manual(values = inauguration("inauguration_2021"), labels = c("Voter Man-MP Man", "Voter Man-MP Woman", "Voter Woman-MP Man", "Voter Woman-MP Woman")) +
  scale_shape_manual(values=c(15,16,17,18), labels = c("Voter Man-MP Man", "Voter Man-MP Woman", "Voter Woman-MP Man", "Voter Woman-MP Woman")) +
  labs(color="MP & voter gender \n combination", shape="MP & voter gender \n combination") +
  theme_bw() + ylim(2.65,4.2) +
  facet_grid(model~outcome, scales="free") +
  theme(axis.text=element_text(size=11),
        strip.text.y = element_text(size=11),
        strip.text.x = element_text(size=11),
        legend.title = element_text(size=11))

evidence_mp_voter <- bind_rows(
  tidy(evidence_likeability_woman_woman, conf.int = T)%>%mutate(model="Evidence", mp_gender="WomanMP", voter_gender="WomanVoter", outcome="Likeability"),
  tidy(evidence_likeability_woman_man, conf.int = T)%>%mutate(model="Evidence", mp_gender="WomanMP", voter_gender="ManVoter", outcome="Likeability"),
  tidy(evidence_likeability_man_woman, conf.int = T)%>%mutate(model="Evidence", mp_gender="ManMP", voter_gender="WomanVoter", outcome="Likeability"),
  tidy(evidence_likeability_man_man, conf.int = T)%>%mutate(model="Evidence", mp_gender="ManMP", voter_gender="ManVoter", outcome="Likeability"),
  tidy(evidence_competence_woman_woman, conf.int = T)%>%mutate(model="Evidence", mp_gender="WomanMP", voter_gender="WomanVoter", outcome="Competence"),
  tidy(evidence_competence_woman_man, conf.int = T)%>%mutate(model="Evidence", mp_gender="WomanMP", voter_gender="ManVoter", outcome="Competence"),
  tidy(evidence_competence_man_woman, conf.int = T)%>%mutate(model="Evidence", mp_gender="ManMP", voter_gender="WomanVoter", outcome="Competence"),
  tidy(evidence_competence_man_man, conf.int = T)%>%mutate(model="Evidence", mp_gender="ManMP", voter_gender="ManVoter", outcome="Competence"),
  tidy(evidence_woman_woman, conf.int = T)%>%mutate(model="Evidence", mp_gender="WomanMP", voter_gender="WomanVoter", outcome="Style Perception"),
  tidy(evidence_woman_man, conf.int = T)%>%mutate(model="Evidence", mp_gender="WomanMP", voter_gender="ManVoter", outcome="Style Perception"),
  tidy(evidence_man_woman, conf.int = T)%>%mutate(model="Evidence", mp_gender="ManMP", voter_gender="WomanVoter", outcome="Style Perception"),
  tidy(evidence_man_man, conf.int = T)%>%mutate(model="Evidence", mp_gender="ManMP", voter_gender="ManVoter", outcome="Style Perception"))%>%
  mutate(treatment=c("Statistical", "Anecdotal", "Statistical", "Anecdotal", "Statistical", "Anecdotal", "Statistical", "Anecdotal",
                     "Statistical", "Anecdotal", "Statistical", "Anecdotal", "Statistical", "Anecdotal", "Statistical", "Anecdotal",
                     "Statistical", "Anecdotal", "Statistical", "Anecdotal", "Statistical", "Anecdotal", "Statistical", "Anecdotal"))

evidence_mp_voter_plot <- ggplot(evidence_mp_voter, aes(y=estimate,x=treatment, color = interaction(mp_gender, voter_gender),
                                                            shape = interaction(mp_gender, voter_gender),
                                                            group=interaction(mp_gender, voter_gender))) +
  geom_point(position = position_dodge(width=0.3)) + ylab("") + xlab("") +
  geom_linerange(position = position_dodge(width=0.3), aes(ymin = conf.low, ymax = conf.high)) +
  scale_color_manual(values = inauguration("inauguration_2021"), labels = c("Voter Man-MP Man", "Voter Man-MP Woman", "Voter Woman-MP Man", "Voter Woman-MP Woman")) +
  scale_shape_manual(values=c(15,16,17,18), labels = c("Voter Man-MP Man", "Voter Man-MP Woman", "Voter Woman-MP Man", "Voter Woman-MP Woman")) +
  labs(color="MP & voter gender \n combination", shape="MP & voter gender \n combination") +
  theme_bw() + ylim(2.65,4.2) +
  facet_grid(model~outcome, scales="free") +
  theme(axis.text=element_text(size=11),
        strip.text.y = element_text(size=11),
        strip.text.x = element_text(size=11),
        legend.title = element_text(size=11))

plots_voter_mp_gender <- emotion_mp_voter_plot / aggression_mp_voter_plot / evidence_mp_voter_plot
ggsave("analysis/plots/figure_S6_mp_voter_gender_conditional.pdf", plots_voter_mp_gender, width = 10, height = 6.5)
